USE [RssFeedAggregator]
GO

/****** Object:  Table [dbo].[session]    Script Date: 01/16/2013 22:41:39 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

IF EXISTS (select * from sys.objects where name = 'session' and type = 'u')
    drop table [dbo].[session]

CREATE TABLE [dbo].[session](
	[id] [nvarchar] (50) NOT NULL,
	[date] [datetime] NOT NULL,
	[version] [int] NOT NULL,
	[user] [int] NOT NULL,
 CONSTRAINT [PK_session] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[session]  WITH CHECK ADD  CONSTRAINT [FK_session_user] FOREIGN KEY([user])
REFERENCES [dbo].[user] ([id])
GO

ALTER TABLE [dbo].[session] CHECK CONSTRAINT [FK_session_user]
GO

ALTER TABLE [dbo].[session] ADD  CONSTRAINT [DF_session_date]  DEFAULT (getdate()) FOR [date]
GO

ALTER TABLE [dbo].[session] ADD  CONSTRAINT [DF_session_version]  DEFAULT ('unknow') FOR [version]
GO


